# Maintainer: Hoang Nguyen <folliekazetani@protonmail.com>
pkgname=ansible-bender
pkgver=0.10.1
pkgrel=2
pkgdesc="Container image builder using Buildah and Ansible"
url="https://ansible-community.github.io/ansible-bender/"
# s390x, loongarch64: blocked by aardvark-dns and netavark -> podman
arch="all !s390x !loongarch64"
license="MIT"
depends="
	ansible-core
	buildah
	py3-jsonschema
	py3-tabulate
	py3-yaml
	"
makedepends="
	py3-gpep517
	py3-setuptools
	py3-setuptools_scm
	py3-wheel
	"
checkdepends="py3-pytest py3-flexmock podman"
subpackages="$pkgname-pyc $pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/ansible-community/ansible-bender/archive/refs/tags/$pkgver.tar.gz"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest tests/unit/
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl

	install -Dm644 docs/md_docs/*.md -t "$pkgdir"/usr/share/doc/$pkgname/
}

sha512sums="
46388d075a484ee97ecfe0340bce63cccd1a014e9ff4bba96a9e1cf68d870fb6840fb10203bc24c9ef286cc2ddf5c2111fc2c6a03d5f3aeda72881c542d0dfcc  ansible-bender-0.10.1.tar.gz
"
